<?php
include './inc/PAGE.php';
$p = new PAGE("");

$loginOk = $p->s()->getvar("loginOk");
$username = $p->s()->getvar("username");
$type = $p->s()->getvar("type");
if($loginOk==1  && strlen($username)>0 && ($type==LIB || $type==USER)) {
    $p = new PAGE("Πληροφορίες");
}else {
    header("Location: ./index.php");
}

$edit = $_GET['edit'];

$sql = "SELECT id, name, email, details, type FROM users WHERE username='".$username."'";
$userdetails = $p->db()->resultasarray($sql);

/*
$p->t()->debug($selectbook);
$p->t()->debug($searchterm);
$p->t()->debug($byterm);
$p->t()->debug($wheresql);

*/
?>
<form action="ze_user_info_do.php" method="POST">
    <table border="0" cellpadding="3" class="tableform">
        <tr>
            <td colspan="2" align="center">
                <b>Επεξεργασία Πληροφοριών</b>
            </td>
        </tr>
        <tr>
            <td align="right">Χρήστης, Τύπος</td>
            <td>
                <input type="hidden" name="id" value="<?=$userdetails[0][0]?>"/>
                <?=$username.", <b>".$type."</b>"?>
            </td>
        </tr>
        <tr>
            <td align="right">Όν/μο</td>
            <td><input type="text" name="name" value="<?=$userdetails[0][1]?>" /></td>
        </tr>
        <tr>
            <td align="right">Email</td>
            <td><input type="text" name="email" value="<?=$userdetails[0][2]?>" /></td>
        </tr>
        <tr>
            <td align="right">Λεπτομέρειες</td>
            <td><input type="text" name="details" value="<?=$userdetails[0][3]?>" /></td>
        </tr>
        <tr>
            <td align="right" valign="top">Παλαιός κωδικός</td>
            <td><input type="password" name="oldpass" value=""/></td>
        </tr>
                <tr>
            <td align="right" valign="top">Νέος κωδικός</td>
            <td><input type="password" name="pass1" value=""/></td>
        </tr>
        <tr>
            <td align="right">Νέος κωδικός<br/>(επαλήθευση)</td>
            <td><input type="password" name="pass2" value="" /><?=$_GET['error']?></td>
        </tr>
        <tr>
            <td align="right"></td>
            <td><input type="submit" value="Καταχώρηση" /></td>
        </tr>
    </table>
</form>


<?
$p->close();
?>